package org.example.exception;


import org.example.util.JsonResult;
import org.example.util.ResultTool;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalException {
    @ExceptionHandler(UserLoginException.class)
    public JsonResult userLoginException(Throwable e) {
        return ResultTool.fail(5001, e.getMessage());
    }

    @ExceptionHandler(NotLoginException.class)
    public JsonResult notLoginException(Throwable e) {
        return ResultTool.fail(5002, e.getMessage());
    }
}
